<!-- 未录入成绩课程成绩查询-->
<template>
  <div class="assessment-container">
    <div class="search-container" style="flex-direction: column;">
      <div class="search-container-left">
        <div class="search-container-item">
          <span>学期</span>
          <el-select
            v-model="termid"
            style="width: 120px"
            size="mini"
            clearable
            placeholder="请选择学期"
          >
          <!-- @clear="queryPostList" -->
            <el-option
              v-for="item in xqList"
              :key="item.xqmc"
              :label="item.xqmc"
              :value="item.xqmc"
            >
            </el-option>
          </el-select>
        </div>
        <div class="search-container-item">
          <span>教研室</span>
          <el-select
            v-model="teachingandresearchsection"
            style="width: 120px"
            size="mini"
            clearable
            placeholder="请选择教研室"
          >
            <el-option
              v-for="item in jysList"
              :key="item.deptName"
              :label="item.deptName"
              :value="item.deptName"
            >
            </el-option>
          </el-select>
        </div>
        <div class="search-container-item">
          <span>培养层次</span>
          <el-select
            v-model="traininglevel"
            style="width: 120px"
            size="mini"
            clearable
            placeholder="请选择培养层次"
          >
            <el-option
              v-for="item in pyccList"
              :key="item.dictKey"
              :label="item.dictValue"
              :value="item.dictKey"
            >
            </el-option>
          </el-select>
        </div>

        <div class="search-container-item">
          <span>修习类型</span>
          <el-select
            v-model="studytype"
            style="width: 120px"
            size="mini"
            clearable
            placeholder="请选择修习类型"
          >
            <el-option
              v-for="item in xxlxList"
              :key="item.value"
              :label="item.label"
              :value="item.value"
            >
            </el-option>
          </el-select>
        </div>
        <div class="search-container-item">
          <span>教员名称</span>
          <el-input
            style="width: 120px"
            size="mini"
            placeholder="请输入教员名称"
            clearable
            v-model="teachingfaculty"
          ></el-input>
        </div>
        <div class="search-container-item">
          <span>课程名称</span>
          <el-input
            style="width: 120px"
            size="mini"
            placeholder="请输入课程名称"
            clearable
            v-model="coursename"
          ></el-input>
        </div>
      </div>
      <div class="search-container-right" style="justify-content: space-between; padding-top:20px">
        <div class="search-container-left">
          <div class="search-container-item" style="margin-top:4px">
            <span>分项类型：</span>
          </div>
          <div class="search-container-item" style="margin-top:4px;margin-left:-20px">

            <el-checkbox v-model="kxzy"></el-checkbox>
            <span>课下作业</span>
          </div>
          <div class="search-container-item" style="margin-top: 4px;">

            <el-checkbox v-model="kxcp"></el-checkbox>
            <span>课堂测评</span>
          </div>
          <div class="search-container-item" style="margin-top: 4px;">

            <el-checkbox v-model="qzks"></el-checkbox>
            <span>期中考试</span>
          </div>
          <div class="search-container-item" style="margin-top: 4px;">

            <el-checkbox v-model="kzkh"></el-checkbox>
            <span>课终考核</span>
          </div>
          <!-- <el-button type="primary" size="mini" @click="queryPostList" icon="el-icon-search">查 询</el-button> -->
          <div class="search-button" @click="queryPostList" style="margin: 2px 0 0 0;">
            <img src="../../../assets/assessment/icon-search.png" alt=""/>
            <span>查 询</span>
          </div>
        </div>
        <div class="search-container-right">

        </div>
      </div>
    </div>
    <div class="plan-entry-table-container">
      <el-table
        :data="tableData"
        style="width: 100%"
        class="xpaas-table-class"
        row-class-name="xpaas-row-class"
        cell-class-name="xpaas-cell-class"
        header-row-class-name="xpaas-header-row-class"
        header-cell-class-name="xpaas-header-cell-class"
      >

        <el-table-column prop="termid" label="学期" align="center">
        </el-table-column>
        <el-table-column prop="teachingandresearchsection" label="教研室" align="center">
        </el-table-column>
        <el-table-column prop="coursenumber" align="center">
          <template slot-scope="scope" slot="header">
            <div>课程编号</div>
            <div>【课程名称】</div>
          </template>
          <template slot-scope="scope">
            <div>{{ scope.row.coursenumber }}</div>
            <div>{{ scope.row.coursename }}</div>
          </template>
        </el-table-column>
        <el-table-column prop="classes" label="教学班" align="center">
        </el-table-column>
        <el-table-column
          prop="professionaldivisions"
          label="专业班次"
          width="292"
          align="center"
        >
        </el-table-column>
        <el-table-column prop="teachingfaculty" label="任课教员" align="center">
        </el-table-column>
        <el-table-column prop="ktwork" align="center" v-if="kxzy">
          <template slot-scope="scope" slot="header">
            <div>课下作业</div>
            <div>(已录/已审)</div>
          </template>
        </el-table-column>
        <el-table-column prop="ktreview" align="center" v-if="kxcp">
          <template slot-scope="scope" slot="header">
            <div>课堂测评</div>
            <div>(已录/已审)</div>
          </template>
        </el-table-column>
        <el-table-column prop="qzreview" align="center" v-if="qzks">
          <template slot-scope="scope" slot="header">
            <div>期中考试</div>
            <div>(已录/已审)</div>
          </template>
        </el-table-column>
        <el-table-column prop="kzreview" align="center" v-if="kzkh">
          <template slot-scope="scope" slot="header">
            <div>课终考核</div>
            <div>(已录/已审)</div>
          </template>
        </el-table-column>
      </el-table>
      <div class="block" style="margin-bottom: 50px;">
        <el-pagination
          style="width:auto;margin-top: 15px;float:right;margin-bottom:50px;padding:0"
          @size-change="handleSizeChange"
          @current-change="handleCurrentChange"
          :current-page="cuurrentPage"
          :page-sizes="[5, 10, 20, 30,50,100,200]"
          :page-size="5"
          layout="total, sizes, prev, pager, next, jumper"
          :total="tableData.length > 0 ? tableData[0].tol : ''"
        >
        </el-pagination>
      </div>
    </div>
    <!-- <div class="bottom-block">
      <div class="export-button">
        <img src="../../../assets/assessment/icon-export.png" alt=""/>
        <span>导出Excel</span>
      </div>
      <div class="text">授课教员名字后加“*”为课程负责人</div>
    </div> -->
    <el-dialog
      title="导出总评成绩单"
      :visible.sync="showExportReportDialog"
      width="1185px"

      class="manual-entry-containerass"
    >
      <div class="my-form-container" style="width:100%;height:100px">
        <el-row>
          <el-col :span="16">
            <div>标准体系名称</div>
            <div>
              <el-radio-group v-model="reportType">
                <el-radio
                  :label="item.label"
                  v-for="(item, index) in reportTypes"
                  :key="index"
                  class="large"
                >{{ item.value }}
                </el-radio
                >
              </el-radio-group>
            </div>
          </el-col>

        </el-row>


      </div>
      <span slot="footer" class="dialog-footer">
        <button @click="showExportReportDialog = false">保存</button>
      </span>
    </el-dialog>

    <el-dialog
      title="导出分项成绩单"
      :visible.sync="showExportReportDialogags"
      width="1185px"

      class="manual-entry-containerass"
    >
      <div class="my-form-container" style="width:100%;height:195px">
        <el-row>
          <el-col :span="16">
            <div>标准体系名称</div>
            <div>
              <el-radio-group v-model="reportType">
                <el-radio
                  :label="item.label"
                  v-for="(item, index) in reportTypes"
                  :key="index"
                  class="large"
                >{{ item.value }}
                </el-radio
                >
              </el-radio-group>
            </div>
          </el-col>

        </el-row>
        <el-row style="width:100%">
          <el-col :span="16">
            <div>标准体系名称</div>
            <div>
              <el-radio-group v-model="reportTypeags">
                <el-radio
                  :label="item.label"
                  v-for="(item, index) in reportTypesags"
                  :key="index"
                  class="large"
                >{{ item.value }}
                </el-radio
                >
              </el-radio-group>
            </div>
          </el-col>

        </el-row>

      </div>
      <span slot="footer" class="dialog-footer">
        <button @click="showExportReportDialogags = false">保存</button>
      </span>
    </el-dialog>

    <el-dialog
      title="按模板导入课程成绩"
      :visible.sync="showInportReportDialog"
      class="import-report-container"
      width="983px"
    >
      <div>
        <span>请选择数据文件：</span>
        <input type="text" v-model="filepath"/>
        <div @click="changeInputFile()">
          <span>浏览</span>
          <input
            type="file"
            id="theFile"
            name="theFile"
            onchange="document.getElementById('theFilePath').value=this.value"
          />
        </div>
        <div>下载数据模板文件</div>
      </div>
      <span slot="footer" class="dialog-footer">
        <button class="green" @click="showInportReportDialog = false">
          提交
        </button>
      </span>
    </el-dialog>
  </div>
</template>

<script>
import {conditionPostLists} from "@/api/courseAchievement/printEntry";
import {reqGetXqList, reqCheckLevelList} from '@/api/admin1/check'
import {getClass} from '@/api/course/courses'
export default {
  data() {
    return {
      pageNo:1,
      pageSize:5,
      kxzy: false,
      kxcp: false,
      qzks: false,
      kzkh: false,
      termid: "",
      traininglevel: '',
      teachingandresearchsection: '',
      studytype: '',
      coursename: '',
      teachingfaculty: '',
      xqList: [],
      jysList: [],
      pycc: "",
      pyccList: [],
      xxlx: "必修",
      xxlxList: [
        {
          value: "选修",
          label: "选修",
        },
        {
          value: "必修",
          label: "必修",
        }
      ],
      tableData: [],
      v1: "",
      showExportReportDialog: false,
      showExportReportDialogags: false,
      reportType: "按教学班导出",
      reportTypes: [
        {label: "按教学班导出", value: "按教学班导出"},
        {label: "按课程导出", value: "按课程导出"},
      ],
      reportTypeags: '课下作业',
      reportTypesags: [
        {label: "课下作业", value: "课下作业"},
        {label: "课下测评", value: "课下测评"},
        {label: "期中考试", value: "期中考试"},
        {label: "课终考核", value: "课终考核"},
      ],
    };
  },
  mounted() {
    // 初始化学期、教研室、培养层次下拉选项
    this.handleInitXqList()
    this.handleInitJysList()
    this.handleInitPyccList()
    this.queryPostList();
  },
  methods: {
    handleCurrentChange(val) {
      this.pageNo = val;
      this.queryPostList();
    },
    handleSizeChange(val) {
      this.pageSize = val;
      this.queryPostList();
    },
    toManualEntry() {
      this.$router.push("/admin/testa/manualEntrybcc");
    },
    toMakeupScoreEntry() {
      this.$router.push("/admin/testa/entryResultsbcc");
    },
    queryPostList: function () {
      if (this.$route.query.reportType) {
       let row= this.$route.query.reportType
        switch (row) {
          case '课下作业':
            this.kxzy=true
            break;
          case '课下测评':
            this.kxcp=true
            break;
          case '期中考试':
            this.qzks=true
            break;
          case '课终考核':
            this.kzkh=true
            break;
          default:
        }

      } else {
        this.kxzy=true
      }
      let obj = {
        termid: this.termid,
        traininglevel: this.traininglevel,
        studytype: this.studytype,
        coursename: this.coursename,
        teachingfaculty: this.teachingfaculty,
        teachingandresearchsection: this.teachingandresearchsection,
        pageNo:this.pageNo,
        pageSize:this.pageSize
      }
      return new Promise(() => {
        conditionPostLists(obj).then(res => {
          if (res.data.code == 200) {
            this.tableData = res.data.data
            this.pageNo = 1
          }
        })
      })
    },
    handleInitXqList: function () {
      return new Promise(() => {
        reqGetXqList().then(res => {
          this.xqList = res.data.data
        })
      })
    },
    handleInitJysList: function () {
      return new Promise(() => {
        getClass().then(res => {
          this.jysList = res.data.data
        })
      })
    },
    handleInitPyccList: function () {
      return new Promise(() => {
        reqCheckLevelList().then(res => {
          this.pyccList = res.data.data[0].children
        })
      })
    }
  },
};
</script>
<style lang="less" scoped>
.assessment-container {
  width: 100% !important;
  .export-report-container {
    .el-dialog__body {
      padding: 64px 0 64px 50px;

      .el-radio {
        margin-right: 79px;
      }
    }

    .el-dialog__footer {
      padding-bottom: 103px;
    }
  }

  .import-report-container {
    .el-dialog__body {
      padding-left: 165px;
      padding-top: 71px;
      padding-bottom: 60px;

      > div {
        > span {
          font-size: 18px;
          font-weight: bold;
          line-height: 20px;
          color: #004ca7;
          vertical-align: middle;
        }

        > input {
          width: 254px;
          height: 25px;
          border: 1px solid #004ca7;
          opacity: 1;
          border-radius: 4px;
          padding-left: 5px;
          margin-right: 8px;
          color: #004ca7;
          vertical-align: middle;
        }

        > div {
          display: inline-block;
          font-size: 18px;
          padding: 1px 10px;
          border-radius: 4px;
          vertical-align: middle;
          cursor: pointer;

          &:nth-child(3) {
            color: rgba(2, 200, 108, 1);
            background: #f1fff8;
            border: 1px solid #02c86c;
            position: relative;
            margin-right: 20px;

            > input {
              width: 0px;
              position: absolute;
              left: 0;
              opacity: 1;
              cursor: pointer;
            }
          }

          &:nth-child(4) {
            color: rgba(82, 48, 233, 1);
            background: rgba(235, 230, 255, 1);
            border: 1px solid rgba(82, 48, 233, 1);
          }
        }
      }
    }

    .el-dialog__footer {
      padding-bottom: 76px;

      .green {
        padding: 1px 17px;
      }
    }
  }

  .manual-entry-container {
    .el-dialog__body {
      > div {
        width: 1014px;
        border: 1px solid rgba(0, 76, 167, 0.8);
        border-radius: 6px;
        margin: 0 auto;

        > div {
          border-bottom: 1px solid rgba(0, 76, 167, 0.39);

          &:last-child {
            border-bottom: none;
          }

          > div {
            display: flex;

            > div {
              height: 96px;
              display: flex;
              align-items: center;
              justify-content: center;

              &:nth-child(1) {
                width: 420px;
                text-align: center;
                font-size: 16px;
                font-weight: bold;
                color: #004ca7;
                background: rgba(77, 129, 192, 0.1);
              }

              &:nth-child(2) {
                padding-left: 19px;
              }
            }
          }
        }
      }
    }

    .el-dialog__footer {
      padding-bottom: 43px;
    }

    .dialog-footer {
      > button {
        width: 87px;
        height: 36px;
        background: #fff6ef;
        border: 1px solid #f3b815;
        border-radius: 6px;
        background: rgba(255, 246, 239, 1);
        font-size: 18px;
        color: #f3b815;
      }
    }
  }

  .manual-entry-containerass {
    .el-dialog__body {

      > div {
        width: 1014px;
        border: 1px solid rgba(0, 76, 167, 0.8);
        border-radius: 6px;
        margin: 0 auto;

        > div {
          border-bottom: 1px solid rgba(0, 76, 167, 0.39);

          &:last-child {
            border-bottom: none;
          }

          > div {
            display: flex;

            > div {
              width: 900px;
              height: 96px;
              display: flex;
              align-items: center;
              justify-content: center;

              &:nth-child(1) {
                width: 420px;
                text-align: center;
                font-size: 16px;
                font-weight: bold;
                color: #004ca7;
                background: rgba(77, 129, 192, 0.1);
              }

              &:nth-child(2) {
                padding-left: 19px;
              }
            }
          }
        }
      }
    }

    .el-dialog__footer {
      padding-bottom: 43px;
    }

    .dialog-footer {
      > button {
        width: 87px;
        height: 36px;
        background: #fff6ef;
        border: 1px solid #f3b815;
        border-radius: 6px;
        background: rgba(255, 246, 239, 1);
        font-size: 18px;
        color: #f3b815;
      }
    }
  }
}

.plan-entry-table-container {
  margin-top: 15px;

  .el-table td,
  .el-table th.is-leaf,
  .el-table--border,
  .el-table--group {
    border-color: #c7d7eb;
  }

  .el-table__header tr,
  .el-table__header th {
    padding: 0;
    height: 76px;
    background-color: #edf2f9;
    font-size: 16px;
    font-family: Microsoft YaHei;
    font-weight: bold;
    line-height: 20px;
    color: #004ca7;
  }

  .el-table__body tr,
  .el-table__body td {
    padding: 0;
    height: 86px;
  }

  .el-checkbox__inner:hover {
    border-color: #004ca7;
  }

  .el-checkbox__inner {
    border: 1px solid #004ca7;
    border-radius: 0;
  }

  .el-checkbox__input.is-checked .el-checkbox__inner,
  .el-checkbox__input.is-indeterminate .el-checkbox__inner {
    background-color: #004ca7;
    border-color: #004ca7;
  }

  .el-checkbox__input.is-checked + .el-checkbox__label {
    color: #004ca7;
  }

  .el-checkbox.is-bordered.is-checked {
    border-color: #004ca7;
  }

  .el-checkbox__input.is-focus .el-checkbox__inner {
    border-color: #004ca7;
  }

  .export-button {
    background: #fff6ef;
    border: 1px solid #f3b815;
    width: auto;
    height: 28px;
    line-height: 28px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    padding: 3px 10px;
    box-sizing: border-box;

    > span {
      font-size: 16px;
      font-family: Microsoft YaHei;
      font-weight: 400;
      color: #f3b815;
    }

    > img {
      width: 16px;
      height: 16px;
      margin-right: 5px;
    }
  }

  .lucj-import-button {
    .export-button;
    width: 116px;
    margin: 0 auto 12px;
    background: #f1fff8;
    border: 1px solid #02c86c;

    &:last-child {
      margin-bottom: 0px;
    }

    > span {
      color: #02c86c;
    }
  }

  .lucj-expot-button {
    .export-button;
    background: #fff6ef;
    border: 1px solid #f3b815;
    width: 81px;
    margin: 0 auto 12px;

    &:last-child {
      margin-bottom: 0px;
    }

    > span {
      color: #f3b815;
    }
  }
}
</style>

<style lang="less" scoped>
@import "../../../styles/print-entry.less";

.plan-entry-table-container {
  margin-top: 15px;

  .table-data {
    width: 100%;
    border: 0.8px solid #004ca7;
    border-radius: 9px;
    font-size: 14px;
    font-family: Microsoft YaHei;
    font-weight: 400;
    color: #004ca7;
  }
}
@fontFamily:"Microsoft YaHei";
.xpaas-table-class {
  border: 1px solid #004ca7;
  border-radius: 9px;
  > ::v-deep div.el-table__header-wrapper {
    > table.el-table__header {
      > thead {
        > tr.xpaas-header-row-class {
          padding: 0;
          height: 76px;
          background-color: #edf2f9;
          font-size: 16px;
          font-family: Microsoft YaHei;
          font-weight: bold;
          line-height: 20px;
          color: #004ca7;
          > th.xpaas-header-cell-class {
            font-weight: bold;
            border-right: 1px solid #c7d7eb;
            border-left: 0;
            border-bottom: 1px solid #c7d7eb;
            background-color: #edf2f9;
            > div.cell {
              font-size: 16px;
              font-weight: bold;
              font-family: @fontFamily;
              color: #004ca7;
            }
          }
        }
      }
    }
  }
  > ::v-deep div.el-table__body-wrapper {
    > table.el-table__body {
      > tbody {
        > tr.xpaas-row-class {
          > td.xpaas-header-cell-class {
            border-right: 1px solid #c7d7eb;
            border-left: 0;
            border-bottom: 1px solid #c7d7eb;
            background-color: #edf2f9;
            > div.cell {
              font-size: 16px;
              font-weight: bold;
              font-family: @fontFamily;
              color: #004ca7;
            }
          }
          > td.xpaas-cell-class {
            height: 76px;
            
            border-right: 1px solid #c7d7eb;
            border-left: 0;
            border-bottom: 1px solid #c7d7eb;
            > div.cell {
              font-weight: normal;
              font-family: @fontFamily;
              color: #004ca7;
            }
          }
        }
      }
    }
  }
}
</style>
